import os
import datetime
import time
from threading import Timer
import sched
import json

from libs.config import Din1

import platform
import requests


url = "https://rsksapp.rsj.nantong.gov.cn/kw/service/counter/login"# 登录
headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36"
}


data={
    "serial":"10000000a439588e"
    
}

r= requests.post(url,data=data,headers=headers)
# print(r)
json_str =r.content.decode()
json_dict = json.loads(json_str )
token=json_dict['data']

print(json_str)

#linux ping limit times: ping -c 1 qq.com >/dev/null
#windows ping limit times:  ping -n 1 www.baidu.com>nul
# return1 = os.system('ping -n 1 www.baidu.com>nul')
# if return1:
#     print('ping fail')
#     # os.system('msdt.exe /id NetworkDiagnosticsNetworkAdapter')#调用系统网络诊断
# else:
#     print('ping Ok')

# print(platform.system())

# def time_printer():
#     now = datetime.datetime.now()
#     ts = now.strftime('%Y-%m-%d %H:%M:%S')
#     print('do func time : ', ts)

# # def loop_monitor():
# #     t = Timer(5, time_printer)
# #     t.start()

# # if __name__ == '__main__':
# #     loop_monitor()

# def loop_monitor():
#     s = sched.scheduler(time.time, time.sleep)
#     s.enter(5, 1, time_printer, ())